#!/usr/bin/perl 

use strict;

use DBI;
use CGI;
use TTraker;
use strict;

my $dbh;
initialize_dbi();
my $form_ref = parse_input();
print_header();

my %FORM_DATA = %$form_ref; 

my $num = $FORM_DATA{'empNum'};
my $name = $FORM_DATA{'empName'};
my $job = $FORM_DATA{'empJob'};
my $loc = $FORM_DATA{'empLoc'};
my $activity = $FORM_DATA{'activity'};

my ($now, $now_date, $now_time, $logged_in, $stmnt);

data_calculation_enter_date($num, $name, $job, $loc); 

db_disconnect();

############### SUBROUTINES FOLLOW ###############


sub data_calculation_enter_date
{

	my $num = $_[0];
	my $name = $_[1];
	my $job = $_[2];
	my $loc = $_[3];
	my $date;
 	my @agency=();		
	my $agency_ref = get_agencies();
 	my @facility=();		
	my $facility_ref = get_facilities();
   	@agency = @$agency_ref;
	@facility = @$facility_ref;

	print <<ENDHEADER;
	<html>
	<head>
	<link rel='stylesheet' type='text/css' href='${css_ref}trak.css' />
	<script type='text/javascript' src='${js_ref}trak.js'></script>
	<title>trak_02_sup_activity_select_payroll_date</title>
	</head>
	<h2><center>${banner}</center></h2>
	<hr/>
	<br/>
	<form id='box2' autocomplete='off' name='selectCalcDate' action='${cgi_ref}trak_03_data_calculation.pl' method='post'>
	<h3>Enter Date for Daily Reports</h3>
	<input type="hidden" name=empNum value='$num'/>
	<input type="hidden" name=empName value='$name'/>
	<input type="hidden" name=empJob value='$job'/>
	<input type="hidden" name=empLoc value='$loc'/>
	<table>
		<tr>
			<td>Date:<td/>
			<td><input type="text" size=10 name=payDate /><td/>
			<td id='info'> &nbsp YYYY-MM-DD<td/>
		<tr/>
ENDHEADER
#		<tr/>
#			<td>Facility:<td/>
#			<td><select id=facilityId name="facilityID" tabindex=1 >
#for my $j (0..$#facility ) {
#   print "<option value= $facility[$j][0] >$facility[$j][1] </option>";
# }
# print <<ENDHEADER;
#			<td/>
#		<tr/>
print <<ENDHEADER;
	<table/>	
	<br/>
	<br/>
   <input type="submit" value="Generate Daily Reports">
	</div>
   <br/><br/>
   <a href="${cgi_ref}trak_00_adm_activity.pl?num=$num&name=$name&job=$job&loc=$loc">Return to Activities</a>
   <br/><br/>
	</form>
	</body>
	</html>
ENDHEADER

}


